package com.ecar.apm.model;

import java.util.Date;
import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ecar.apm.model.HttpRequest.CheckCondition;
import com.ecar.apm.model.HttpRequest.HttpMethod;
import com.ecar.apm.model.HttpRequest.ResultType;
import com.ecar.apm.model.HttpSequence.MonitorType;
import com.ecar.apm.util.GuidGenerator;
import com.github.pagehelper.StringUtil;


public class HttpRequestForm {
	
	protected static final Logger LOGGER = LoggerFactory.getLogger(HttpRequestForm.class);
	  private int id;
	  private String guid;
	  private String pguid;
	  private String group;
	  private MonitorType type;
	  private String name;
	  
	  public static HttpRequestForm getHttpRequestForm(HttpSequence s, HttpRequest r)
	  {
	    HttpRequestForm form = new HttpRequestForm();
	    form.setGuid(r.getGuid());
	    form.setPguid(s.getGuid());
	    
	    form.setGroup(s.getGroup());
	    form.setType(s.getType());
	    form.setName(s.getName());
	    form.setFrequency(s.getFrequency());
	    form.setRemark(s.getRemark());
	    
	    form.setHttpMethod(r.getHttpMethod());
	    form.setUrl(r.getUrl());
	    form.setHeaders(r.getHeaders());
	    form.setParameters(r.getParameters());
	    form.setConditionType(r.getConditionType());
	    form.setCondition(r.getCondition());
	    form.setResultType(r.getResultType());
	    form.setVariables(r.getVariables());
	    form.setMaxConnectionSeconds(r.getMaxConnectionSeconds());
	    return form;
	  }
	  
	  private MonitorFrequency frequency = MonitorFrequency.THIRTY;
	  private int sort = 1;
	  private String url;
	  private String remark;
	  private CheckCondition conditionType = CheckCondition.DEFAULT;
	  private String condition;
	  private ResultType  resultType;
	  private HttpMethod  httpMethod;
	  private String headers;
	  private String parameters;
	  private String variables;
	  private HashMap<String, String> headersMap = new HashMap();
	  private HashMap<String, String> parametersMap = new HashMap();
	  private HashMap<String, String> variablesMap = new HashMap();
	  private int maxConnectionSeconds;
	  private Date createTime;
	  private boolean archived;
	  
	  public int getId()
	  {
	    return this.id;
	  }
	  
	  public void setId(int id)
	  {
	    this.id = id;
	  }
	  
	  public String getGuid()
	  {
	    return this.guid;
	  }
	  
	  public void setGuid(String guid)
	  {
	    this.guid = guid;
	  }
	  
	  public String getPguid()
	  {
	    return this.pguid;
	  }
	  
	  public void setPguid(String pguid)
	  {
	    this.pguid = pguid;
	  }
	  
	  public String getGroup()
	  {
	    return this.group;
	  }
	  
	  public void setGroup(String group)
	  {
	    this.group = group;
	  }
	  
	  public MonitorType  getType()
	  {
	    return this.type;
	  }
	  
	  public void setType(MonitorType  type)
	  {
	    this.type = type;
	  }
	  
	  public String getName()
	  {
	    return this.name;
	  }
	  
	  public void setName(String name)
	  {
	    this.name = name;
	  }
	  
	  public int getSort()
	  {
	    return this.sort;
	  }
	  
	  public void setSort(int sort)
	  {
	    this.sort = sort;
	  }
	  
	  public String getUrl()
	  {
	    return this.url;
	  }
	  
	  public void setUrl(String url)
	  {
	    this.url = url;
	  }
	  
	  public String getRemark()
	  {
	    return this.remark;
	  }
	  
	  public void setRemark(String remark)
	  {
	    this.remark = remark;
	  }
	  
	  public CheckCondition  getConditionType()
	  {
	    return this.conditionType;
	  }
	  
	  public void setConditionType(CheckCondition  conditionType)
	  {
	    this.conditionType = conditionType;
	  }
	  
	  public ResultType  getResultType()
	  {
	    return this.resultType;
	  }
	  
	  public void setResultType(ResultType  resultType)
	  {
	    this.resultType = resultType;
	  }
	  
	  public HttpMethod  getHttpMethod()
	  {
	    return this.httpMethod;
	  }
	  
	  public void setHttpMethod(HttpMethod  httpMethod)
	  {
	    this.httpMethod = httpMethod;
	  }
	  
	  public String getHeaders()
	  {
	    return this.headers;
	  }
	  
	  public void setHeaders(String headers)
	  {
	    this.headers = headers;
	  }
	  
	  public String getParameters()
	  {
	    return this.parameters;
	  }
	  
	  public void setParameters(String parameters)
	  {
	    this.parameters = parameters;
	  }
	  
	  public String getVariables()
	  {
	    return this.variables;
	  }
	  
	  public void setVariables(String variables)
	  {
	    this.variables = variables;
	  }
	  
	  public HashMap<String, String> getHeadersMap()
	  {
	    return this.headersMap;
	  }
	  
	  public void setHeadersMap(HashMap<String, String> headers)
	  {
	    this.headersMap = headers;
	  }
	  
	  public HashMap<String, String> getParametersMap()
	  {
	    return this.parametersMap;
	  }
	  
	  public void setParametersMap(HashMap<String, String> parameters)
	  {
	    this.parametersMap = parameters;
	  }
	  
	  public HashMap<String, String> getVariablesMap()
	  {
	    return this.variablesMap;
	  }
	  
	  public void setVariablesMap(HashMap<String, String> variables)
	  {
	    this.variablesMap = variables;
	  }
	  
	  public int getMaxConnectionSeconds()
	  {
	    return this.maxConnectionSeconds;
	  }
	  
	  public void setMaxConnectionSeconds(int maxConnectionSeconds)
	  {
	    this.maxConnectionSeconds = maxConnectionSeconds;
	  }
	  
	  public String getCondition()
	  {
	    return this.condition;
	  }
	  
	  public void setCondition(String condition)
	  {
	    this.condition = condition;
	  }
	  
	  public Date getCreateTime()
	  {
	    return this.createTime;
	  }
	  
	  public void setCreateTime(Date createTime)
	  {
	    this.createTime = createTime;
	  }
	  
	  public boolean isArchived()
	  {
	    return this.archived;
	  }
	  
	  public void setArchived(boolean archived)
	  {
	    this.archived = archived;
	  }
	  
	  public MonitorFrequency getFrequency()
	  {
	    return this.frequency;
	  }
	  
	  public void setFrequency(MonitorFrequency frequency)
	  {
	    this.frequency = frequency;
	  }
}